package com.android.flickr;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MetaData extends Activity{
	private EditText title = null; 			//optional
	private EditText description = null; 	//(optional)
	private EditText tags = null; 			//(optional).  A space-seperated list of tags to apply to the photo.
	private EditText is_public = null;  	//	is_public, is_friend, is_family (optional)
	private EditText is_friend = null;  	//	Set to 0 for no, 1 for yes. Specifies who can view the photo.
	private EditText is_family = null;
	private EditText safety_level = null; 	//safety_level (optional). Set to 1 for Safe, 2 for Moderate, or 3 for Restricted.
	private EditText content_type = null;  	//content_type (optional). Set to 1 for Photo, 2 for Screenshot, or 3 for Other.
	private EditText hidden = null;  		//hidden (optional). Set to 1 to keep the photo in global search results, 2 to hide from public searches.
	Bundle bundle = new Bundle();
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.meta_data);
        
		//create button object from enter button on screen and add listener.
		Button enterButton = (Button) findViewById(R.id.button_enter_fields);
		enterButton.setOnClickListener(new View.OnClickListener() {
			public void onClick(View view) {
				//get variables;
				title = 		(EditText) findViewById(R.id.inputBox_title);
				description = 	(EditText) findViewById(R.id.inputBox_description);
				tags = 			(EditText) findViewById(R.id.inputBox_tags);
				is_public = 	(EditText) findViewById(R.id.inputBox_is_public);
				is_friend = 	(EditText) findViewById(R.id.inputBox_is_friend);
				is_family = 	(EditText) findViewById(R.id.inputBox_is_family);
				safety_level = 	(EditText) findViewById(R.id.inputBox_safety_level);
				content_type = 	(EditText) findViewById(R.id.inputBox_content_type);
				hidden = 		(EditText) findViewById(R.id.inputBox_hidden);
				
                //add variables to bundle
            	bundle.putString("title", title.getText().toString());
            	bundle.putString("description", description.getText().toString());
            	bundle.putString("tags", tags.getText().toString());
            	bundle.putString("is_public", is_public.getText().toString());
            	bundle.putString("is_friend", is_friend.getText().toString());
            	bundle.putString("is_family", is_family.getText().toString());
            	bundle.putString("safety_level", safety_level.getText().toString());
            	bundle.putString("content_type", content_type.getText().toString());
            	bundle.putString("hidden", hidden.getText().toString());
            	
            	//return bundle and finish activity
            	Intent mIntent = new Intent();
		    	mIntent.putExtras(bundle);
		    	setResult(RESULT_OK, mIntent);
		    	finish();
			}
		});
		
		//create button object from cancel button on screen and add listener
        //set result to canceled
        //finish activity
		Button cancelButton = (Button) findViewById(R.id.button_cancelKey);
		cancelButton.setOnClickListener(new View.OnClickListener() {
		    public void onClick(View view) {
		    	setResult(RESULT_CANCELED);
		    	finish();
		    }
		});
		
		
	}
        
        

}
